const express = require('express');
const router = express.Router();
const {asyncHandler} = require('../utils/sendResult');
const {
    addClockIn, getClockIn, editClockIn,
} = require("../services/clockInServices");

router.post("/", asyncHandler((req, res, next) => {
    req.body.user = req.userInfo._id
    return addClockIn(req.body)
}))

router.get("/", asyncHandler((req, res, next) => {
    return getClockIn(req.query)
}))

router.post("/:id", asyncHandler((req, res, next) => {
    return editClockIn(req.params.id, req.body,req.userInfo._id)
}))

module.exports = router;
